/* A Bison parser, made by GNU Bison 2.4.2.  */

/* Skeleton implementation for Bison LALR(1) parsers in C++
   
      Copyright (C) 2002-2010 Free Software Foundation, Inc.
   
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.
   
   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

// Take the name prefix into account.
#define yylex   MathematicaTranslatorlex

/* First part of user declarations.  */

/* Line 310 of lalr1.cc  */
#line 1 "matrix_grammar.yy"
 /*C++ declarations*/
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <iostream>
#include "CodeGenContext.hpp"
#include "MTBlock.hpp"
MathematicaTranslator::MTBlock* programBlock;
	
const std::string bisonDebugMessageBeginning = "  <BISON DEBUG>: " ;

void bisonDebugMessage(const std::string& msg)
{
		std::cout<<bisonDebugMessageBeginning<<msg << std::endl;	
}



/* Line 310 of lalr1.cc  */
#line 61 "matrix_grammar.tab.cpp"


#include "matrix_grammar.tab.hpp"

/* User implementation prologue.  */

/* Line 316 of lalr1.cc  */
#line 134 "matrix_grammar.yy"

#include "MTDriver.hh"
#include "Scanner.h"

/* this "connects" the bison parser in the driver to the flex scanner class
 * object. it defines the yylex() function call to pull the next token from the
 * current lexer object of the driver context. */
#undef yylex
#define yylex driver.scanner->lex


/* Line 316 of lalr1.cc  */
#line 82 "matrix_grammar.tab.cpp"

#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
#  if ENABLE_NLS
#   include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
#   define YY_(msgid) dgettext ("bison-runtime", msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(msgid) msgid
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#define YYUSE(e) ((void) (e))

/* Enable debugging if requested.  */
#if YYDEBUG

/* A pseudo ostream that takes yydebug_ into account.  */
# define YYCDEBUG if (yydebug_) (*yycdebug_)

# define YY_SYMBOL_PRINT(Title, Type, Value, Location)	\
do {							\
  if (yydebug_)						\
    {							\
      *yycdebug_ << Title << ' ';			\
      yy_symbol_print_ ((Type), (Value), (Location));	\
      *yycdebug_ << std::endl;				\
    }							\
} while (false)

# define YY_REDUCE_PRINT(Rule)		\
do {					\
  if (yydebug_)				\
    yy_reduce_print_ (Rule);		\
} while (false)

# define YY_STACK_PRINT()		\
do {					\
  if (yydebug_)				\
    yystack_print_ ();			\
} while (false)

#else /* !YYDEBUG */

# define YYCDEBUG if (false) std::cerr
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_REDUCE_PRINT(Rule)
# define YY_STACK_PRINT()

#endif /* !YYDEBUG */

#define yyerrok		(yyerrstatus_ = 0)
#define yyclearin	(yychar = yyempty_)

#define YYACCEPT	goto yyacceptlab
#define YYABORT		goto yyabortlab
#define YYERROR		goto yyerrorlab
#define YYRECOVERING()  (!!yyerrstatus_)


namespace MathematicaTranslator {

/* Line 379 of lalr1.cc  */
#line 148 "matrix_grammar.tab.cpp"
#if YYERROR_VERBOSE

  /* Return YYSTR after stripping away unnecessary quotes and
     backslashes, so that it's suitable for yyerror.  The heuristic is
     that double-quoting is unnecessary unless the string contains an
     apostrophe, a comma, or backslash (other than backslash-backslash).
     YYSTR is taken from yytname.  */
  std::string
  Parser::yytnamerr_ (const char *yystr)
  {
    if (*yystr == '"')
      {
        std::string yyr = "";
        char const *yyp = yystr;

        for (;;)
          switch (*++yyp)
            {
            case '\'':
            case ',':
              goto do_not_strip_quotes;

            case '\\':
              if (*++yyp != '\\')
                goto do_not_strip_quotes;
              /* Fall through.  */
            default:
              yyr += *yyp;
              break;

            case '"':
              return yyr;
            }
      do_not_strip_quotes: ;
      }

    return yystr;
  }

#endif

  /// Build a parser object.
  Parser::Parser (class MTDriver& driver_yyarg)
    :
#if YYDEBUG
      yydebug_ (false),
      yycdebug_ (&std::cerr),
#endif
      driver (driver_yyarg)
  {
  }

  Parser::~Parser ()
  {
  }

#if YYDEBUG
  /*--------------------------------.
  | Print this symbol on YYOUTPUT.  |
  `--------------------------------*/

  inline void
  Parser::yy_symbol_value_print_ (int yytype,
			   const semantic_type* yyvaluep, const location_type* yylocationp)
  {
    YYUSE (yylocationp);
    YYUSE (yyvaluep);
    switch (yytype)
      {
         default:
	  break;
      }
  }


  void
  Parser::yy_symbol_print_ (int yytype,
			   const semantic_type* yyvaluep, const location_type* yylocationp)
  {
    *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
	       << ' ' << yytname_[yytype] << " ("
	       << *yylocationp << ": ";
    yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
    *yycdebug_ << ')';
  }
#endif

  void
  Parser::yydestruct_ (const char* yymsg,
			   int yytype, semantic_type* yyvaluep, location_type* yylocationp)
  {
    YYUSE (yylocationp);
    YYUSE (yymsg);
    YYUSE (yyvaluep);

    YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

    switch (yytype)
      {
  
	default:
	  break;
      }
  }

  void
  Parser::yypop_ (unsigned int n)
  {
    yystate_stack_.pop (n);
    yysemantic_stack_.pop (n);
    yylocation_stack_.pop (n);
  }

#if YYDEBUG
  std::ostream&
  Parser::debug_stream () const
  {
    return *yycdebug_;
  }

  void
  Parser::set_debug_stream (std::ostream& o)
  {
    yycdebug_ = &o;
  }


  Parser::debug_level_type
  Parser::debug_level () const
  {
    return yydebug_;
  }

  void
  Parser::set_debug_level (debug_level_type l)
  {
    yydebug_ = l;
  }
#endif

  int
  Parser::parse ()
  {
    /// Lookahead and lookahead in internal form.
    int yychar = yyempty_;
    int yytoken = 0;

    /* State.  */
    int yyn;
    int yylen = 0;
    int yystate = 0;

    /* Error handling.  */
    int yynerrs_ = 0;
    int yyerrstatus_ = 0;

    /// Semantic value of the lookahead.
    semantic_type yylval;
    /// Location of the lookahead.
    location_type yylloc;
    /// The locations where the error started and ended.
    location_type yyerror_range[2];

    /// $$.
    semantic_type yyval;
    /// @$.
    location_type yyloc;

    int yyresult;

    YYCDEBUG << "Starting parse" << std::endl;


    /* User initialization code.  */
    
/* Line 552 of lalr1.cc  */
#line 40 "matrix_grammar.yy"
{
    // initialize the initial location object
    yylloc.begin.filename = yylloc.end.filename = &driver.streamname;
}

/* Line 552 of lalr1.cc  */
#line 332 "matrix_grammar.tab.cpp"

    /* Initialize the stacks.  The initial state will be pushed in
       yynewstate, since the latter expects the semantical and the
       location values to have been already stored, initialize these
       stacks with a primary value.  */
    yystate_stack_ = state_stack_type (0);
    yysemantic_stack_ = semantic_stack_type (0);
    yylocation_stack_ = location_stack_type (0);
    yysemantic_stack_.push (yylval);
    yylocation_stack_.push (yylloc);

    /* New state.  */
  yynewstate:
    yystate_stack_.push (yystate);
    YYCDEBUG << "Entering state " << yystate << std::endl;

    /* Accept?  */
    if (yystate == yyfinal_)
      goto yyacceptlab;

    goto yybackup;

    /* Backup.  */
  yybackup:

    /* Try to take a decision without lookahead.  */
    yyn = yypact_[yystate];
    if (yyn == yypact_ninf_)
      goto yydefault;

    /* Read a lookahead token.  */
    if (yychar == yyempty_)
      {
	YYCDEBUG << "Reading a token: ";
	yychar = yylex (&yylval, &yylloc);
      }


    /* Convert token to internal form.  */
    if (yychar <= yyeof_)
      {
	yychar = yytoken = yyeof_;
	YYCDEBUG << "Now at end of input." << std::endl;
      }
    else
      {
	yytoken = yytranslate_ (yychar);
	YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
      }

    /* If the proper action on seeing token YYTOKEN is to reduce or to
       detect an error, take that action.  */
    yyn += yytoken;
    if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
      goto yydefault;

    /* Reduce or error.  */
    yyn = yytable_[yyn];
    if (yyn <= 0)
      {
	if (yyn == 0 || yyn == yytable_ninf_)
	goto yyerrlab;
	yyn = -yyn;
	goto yyreduce;
      }

    /* Shift the lookahead token.  */
    YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

    /* Discard the token being shifted.  */
    yychar = yyempty_;

    yysemantic_stack_.push (yylval);
    yylocation_stack_.push (yylloc);

    /* Count tokens shifted since error; after three, turn off error
       status.  */
    if (yyerrstatus_)
      --yyerrstatus_;

    yystate = yyn;
    goto yynewstate;

  /*-----------------------------------------------------------.
  | yydefault -- do the default action for the current state.  |
  `-----------------------------------------------------------*/
  yydefault:
    yyn = yydefact_[yystate];
    if (yyn == 0)
      goto yyerrlab;
    goto yyreduce;

  /*-----------------------------.
  | yyreduce -- Do a reduction.  |
  `-----------------------------*/
  yyreduce:
    yylen = yyr2_[yyn];
    /* If YYLEN is nonzero, implement the default value of the action:
       `$$ = $1'.  Otherwise, use the top of the stack.

       Otherwise, the following line sets YYVAL to garbage.
       This behavior is undocumented and Bison
       users should not rely upon it.  */
    if (yylen)
      yyval = yysemantic_stack_[yylen - 1];
    else
      yyval = yysemantic_stack_[0];

    {
      slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
      YYLLOC_DEFAULT (yyloc, slice, yylen);
    }
    YY_REDUCE_PRINT (yyn);
    switch (yyn)
      {
	  case 3:

/* Line 677 of lalr1.cc  */
#line 148 "matrix_grammar.yy"
    { 
						#ifdef DEBUG
							bisonDebugMessage("START PROGRAM");
						#endif		
						programBlock = (yysemantic_stack_[(2) - (1)].block); 				
					}
    break;

  case 4:

/* Line 677 of lalr1.cc  */
#line 156 "matrix_grammar.yy"
    { 
												#ifdef DEBUG
													bisonDebugMessage("STATEMENTS");
												#endif
											
												(yysemantic_stack_[(3) - (3)].block)->statements.push_back( (yysemantic_stack_[(3) - (1)].statement) ); 
												(yyval.block) = (yysemantic_stack_[(3) - (3)].block);					
											}
    break;

  case 5:

/* Line 677 of lalr1.cc  */
#line 164 "matrix_grammar.yy"
    { 
					#ifdef DEBUG
						bisonDebugMessage("SINGLE STATEMENT");
					#endif
					(yyval.block) = new MTBlock(); (yyval.block)->statements.push_back( (yysemantic_stack_[(1) - (1)].statement) ); 
			}
    break;

  case 6:

/* Line 677 of lalr1.cc  */
#line 172 "matrix_grammar.yy"
    { 
								#ifdef DEBUG
									bisonDebugMessage("CREATING EXPRESSION STATEMENT");
								#endif
								(yyval.statement) = new MTExpressionStatement( *(yysemantic_stack_[(1) - (1)].expr) ); 
							}
    break;

  case 10:

/* Line 677 of lalr1.cc  */
#line 183 "matrix_grammar.yy"
    { 
																												#ifdef DEBUG
																													bisonDebugMessage("CREATING 'IF' STATEMENT");
																												#endif
																												(yyval.statement) = new MTIfStatement( *(yysemantic_stack_[(8) - (3)].expr), *(yysemantic_stack_[(8) - (5)].block) , *(yysemantic_stack_[(8) - (7)].block) ); 
																										}
    break;

  case 11:

/* Line 677 of lalr1.cc  */
#line 189 "matrix_grammar.yy"
    { 
																			#ifdef DEBUG
																			bisonDebugMessage("CREATING 'WHILE' STATEMENT");
																			#endif
																			(yyval.statement) = new MTWhileStatement( *(yysemantic_stack_[(6) - (3)].expr), *(yysemantic_stack_[(6) - (5)].block) ); 
																	}
    break;

  case 12:

/* Line 677 of lalr1.cc  */
#line 195 "matrix_grammar.yy"
    { 
																														#ifdef DEBUG
																															bisonDebugMessage("CREATING 'FOR' STATEMENT ");
																														#endif
																														(yyval.statement) = new MTForStatement( *(yysemantic_stack_[(10) - (3)].var_vec), *(yysemantic_stack_[(10) - (5)].expr), *(yysemantic_stack_[(10) - (7)].expr_vec), *(yysemantic_stack_[(10) - (9)].block) ); 
																												}
    break;

  case 13:

/* Line 677 of lalr1.cc  */
#line 203 "matrix_grammar.yy"
    { 
											#ifdef DEBUG
												bisonDebugMessage("CREATING FOR INIT LIST");
											#endif
											(yyval.var_vec) = new VariableList(); (yyval.var_vec)->push_back( (yysemantic_stack_[(1) - (1)].var_def) ); 
										}
    break;

  case 14:

/* Line 677 of lalr1.cc  */
#line 209 "matrix_grammar.yy"
    {	
											#ifdef DEBUG
												bisonDebugMessage("PUSHING VARIABLE DEFINITION TO 'FOR INIT LIST'");
											#endif
											(yysemantic_stack_[(3) - (3)].var_vec)->push_back( (yysemantic_stack_[(3) - (1)].var_def) );	
											(yyval.var_vec) = (yysemantic_stack_[(3) - (3)].var_vec);
										}
    break;

  case 15:

/* Line 677 of lalr1.cc  */
#line 218 "matrix_grammar.yy"
    { 
											#ifdef DEBUG
												bisonDebugMessage("CREATING EXPRESSION IN INCREMENT STATEMENT ");
											#endif
											(yyval.expr_vec) = new ExpressionList(); (yyval.expr_vec)->push_back((yysemantic_stack_[(1) - (1)].expr));
										}
    break;

  case 16:

/* Line 677 of lalr1.cc  */
#line 224 "matrix_grammar.yy"
    { 
											#ifdef DEBUG
												bisonDebugMessage("PUSHING EXPRESSION TO LIST IN INCREMENT STATEMENT");
											#endif
											(yysemantic_stack_[(3) - (3)].expr_vec)->push_back((yysemantic_stack_[(3) - (1)].expr)); 
										}
    break;

  case 19:

/* Line 677 of lalr1.cc  */
#line 234 "matrix_grammar.yy"
    { 
																										#ifdef DEBUG
																											bisonDebugMessage("CREATING FUNCTION DEFINITION");
																										#endif
																										(yyval.statement) = new MTFunctionDefinition( *(yysemantic_stack_[(6) - (1)].id), *(yysemantic_stack_[(6) - (3)].decl_var_vec), *(yysemantic_stack_[(6) - (6)].statement) ); 
																								}
    break;

  case 21:

/* Line 677 of lalr1.cc  */
#line 243 "matrix_grammar.yy"
    { 
					#ifdef DEBUG
						bisonDebugMessage("CREATING EXPRESSION IN FUNCTION STATEMENT");
					#endif
					(yyval.statement) = new MTExpressionStatement( *(yysemantic_stack_[(1) - (1)].expr) ); 
				}
    break;

  case 22:

/* Line 677 of lalr1.cc  */
#line 251 "matrix_grammar.yy"
    { 
																				#ifdef DEBUG
																					bisonDebugMessage("CREATING VARIABLE DEFINITION");
																				#endif
																				(yyval.var_def) = new MTVariableDefinition( *(yysemantic_stack_[(3) - (1)].id), (yysemantic_stack_[(3) - (3)].expr) ); 
																			}
    break;

  case 23:

/* Line 677 of lalr1.cc  */
#line 259 "matrix_grammar.yy"
    { 
																				#ifdef DEBUG
																					bisonDebugMessage("CREATING VARIABLE DECLARATION");
																				#endif
																				(yyval.var_decl) = new MTVariableDeclaration( *(yysemantic_stack_[(1) - (1)].id) ); 
																			}
    break;

  case 24:

/* Line 677 of lalr1.cc  */
#line 266 "matrix_grammar.yy"
    {
																					#ifdef DEBUG
																						bisonDebugMessage("CREATING CONTAINER VARIABLE DECLARATION");
																					#endif
																					(yyval.con_var_def) = new MTContainerVariableDefinition( *(yysemantic_stack_[(3) - (1)].id), (yysemantic_stack_[(3) - (3)].expr) );
																				}
    break;

  case 25:

/* Line 677 of lalr1.cc  */
#line 274 "matrix_grammar.yy"
    { 
																					#ifdef DEBUG
																						bisonDebugMessage("PUSHING VARIABLE DECLARATION INTO FUNCTION ARGUMENT LIST");
																					#endif
																					
																					(yysemantic_stack_[(4) - (4)].decl_var_vec)->push_back( (yysemantic_stack_[(4) - (1)].var_decl) ); 
																					(yyval.decl_var_vec) = (yysemantic_stack_[(4) - (4)].decl_var_vec);
																				}
    break;

  case 26:

/* Line 677 of lalr1.cc  */
#line 282 "matrix_grammar.yy"
    {
								#ifdef DEBUG
									bisonDebugMessage("CREATING VARIABLELIST IN FUNCTION ARGUMENT LIST");
								#endif

								(yyval.decl_var_vec) = new DeclaredVariableList(); (yyval.decl_var_vec)->push_back( (yysemantic_stack_[(2) - (1)].var_decl) ); 
							}
    break;

  case 27:

/* Line 677 of lalr1.cc  */
#line 291 "matrix_grammar.yy"
    {
																						#ifdef DEBUG
																							bisonDebugMessage("PUSHING EXPRESSION TO 'ACTUAL ARGUMENT LIST' EXPRESSION LIST");
																						#endif
																						(yysemantic_stack_[(3) - (3)].expr_vec)->push_back((yysemantic_stack_[(3) - (1)].expr));
																						(yyval.expr_vec) = (yysemantic_stack_[(3) - (3)].expr_vec);
																					}
    break;

  case 28:

/* Line 677 of lalr1.cc  */
#line 298 "matrix_grammar.yy"
    {
								#ifdef DEBUG
									bisonDebugMessage("CREATING 'ACTUAL ARGUMENT LIST' EXPRESSION LIST");
								#endif
								(yyval.expr_vec) = new ExpressionList(); (yyval.expr_vec)->push_back((yysemantic_stack_[(1) - (1)].expr));
							}
    break;

  case 30:

/* Line 677 of lalr1.cc  */
#line 307 "matrix_grammar.yy"
    {
								#ifdef DEBUG
									bisonDebugMessage("CREATING BINARY OPERATOR 'AND'");
								#endif
								(yyval.expr) = new MTBinaryOperator( *(yysemantic_stack_[(3) - (1)].expr), *(yysemantic_stack_[(3) - (2)].string), *(yysemantic_stack_[(3) - (3)].expr)); 
							}
    break;

  case 31:

/* Line 677 of lalr1.cc  */
#line 313 "matrix_grammar.yy"
    { 
								#ifdef DEBUG
									bisonDebugMessage("CREATING BINARY OPERATOR 'OR'");	
								#endif
								(yyval.expr) = new MTBinaryOperator( *(yysemantic_stack_[(3) - (1)].expr), *(yysemantic_stack_[(3) - (2)].string), *(yysemantic_stack_[(3) - (3)].expr)); 
							}
    break;

  case 32:

/* Line 677 of lalr1.cc  */
#line 321 "matrix_grammar.yy"
    { 
													#ifdef DEBUG
														bisonDebugMessage("CREATING BINARY OPERATOR 'COMPARISON'");
													#endif
													(yyval.expr) = new MTBinaryOperator( *(yysemantic_stack_[(3) - (1)].expr), *(yysemantic_stack_[(3) - (2)].string), *(yysemantic_stack_[(3) - (3)].expr) ); 
												 }
    break;

  case 40:

/* Line 677 of lalr1.cc  */
#line 333 "matrix_grammar.yy"
    { 
									#ifdef DEBUG
										bisonDebugMessage("CREATING EXPRESSION 'ADD' TERM");
									#endif
									(yyval.expr) = new MTBinaryOperator( *(yysemantic_stack_[(3) - (1)].expr), *(yysemantic_stack_[(3) - (2)].string), *(yysemantic_stack_[(3) - (3)].expr) ); 
							}
    break;

  case 41:

/* Line 677 of lalr1.cc  */
#line 339 "matrix_grammar.yy"
    { 
									#ifdef DEBUG
										bisonDebugMessage("CREATING EXPRESSION 'SUB' TERM");
									#endif
									(yyval.expr) = new MTBinaryOperator( *(yysemantic_stack_[(3) - (1)].expr), *(yysemantic_stack_[(3) - (2)].string), *(yysemantic_stack_[(3) - (3)].expr) ); 
							}
    break;

  case 43:

/* Line 677 of lalr1.cc  */
#line 348 "matrix_grammar.yy"
    { 
									#ifdef DEBUG
										bisonDebugMessage("CREATING TERM 'MUL' PRIMARY");
									#endif
									(yyval.expr) = new MTBinaryOperator( *(yysemantic_stack_[(3) - (1)].expr), *(yysemantic_stack_[(3) - (2)].string), *(yysemantic_stack_[(3) - (3)].expr) ); 
							}
    break;

  case 44:

/* Line 677 of lalr1.cc  */
#line 354 "matrix_grammar.yy"
    { 
									#ifdef DEBUG
										bisonDebugMessage("CREATING TERM 'DIV' PRIMARY");
									#endif
									(yyval.expr) = new MTBinaryOperator( *(yysemantic_stack_[(3) - (1)].expr), *(yysemantic_stack_[(3) - (2)].string), *(yysemantic_stack_[(3) - (3)].expr) ); 
							}
    break;

  case 45:

/* Line 677 of lalr1.cc  */
#line 360 "matrix_grammar.yy"
    { 
									#ifdef DEBUG
										bisonDebugMessage("CREATING TERM 'DOT' PRIMARY");
									#endif
									(yyval.expr) = new MTBinaryOperator( *(yysemantic_stack_[(3) - (1)].expr), *(yysemantic_stack_[(3) - (2)].string), *(yysemantic_stack_[(3) - (3)].expr) ); 
							}
    break;

  case 46:

/* Line 677 of lalr1.cc  */
#line 368 "matrix_grammar.yy"
    { 
						#ifdef DEBUG
							bisonDebugMessage("PASSING ON VARIABLE IN PRIMARY");
						#endif
					 }
    break;

  case 47:

/* Line 677 of lalr1.cc  */
#line 373 "matrix_grammar.yy"
    {
								#ifdef DEBUG
									bisonDebugMessage("CREATING POST DECREMENT OPERATOR");
								#endif
								(yyval.expr) = new MTUnaryOperator( *(yysemantic_stack_[(2) - (1)].id), *(yysemantic_stack_[(2) - (2)].string), POST );
							 }
    break;

  case 48:

/* Line 677 of lalr1.cc  */
#line 379 "matrix_grammar.yy"
    {
								#ifdef DEBUG
									bisonDebugMessage("CREATING POST INCREMENT OPERATOR");
								#endif
								(yyval.expr) = new MTUnaryOperator( *(yysemantic_stack_[(2) - (1)].id), *(yysemantic_stack_[(2) - (2)].string), POST );
							 }
    break;

  case 49:

/* Line 677 of lalr1.cc  */
#line 385 "matrix_grammar.yy"
    {
								#ifdef DEBUG
									bisonDebugMessage("CREATING PRE INCREMENT OPERATOR");
								#endif
								(yyval.expr) = new MTUnaryOperator( *(yysemantic_stack_[(2) - (2)].id), *(yysemantic_stack_[(2) - (1)].string), PRE );
							 }
    break;

  case 50:

/* Line 677 of lalr1.cc  */
#line 391 "matrix_grammar.yy"
    {
								#ifdef DEBUG
									bisonDebugMessage("CREATING PRE DECREMENT OPERATOR");
								#endif
								(yyval.expr) = new MTUnaryOperator( *(yysemantic_stack_[(2) - (2)].id), *(yysemantic_stack_[(2) - (1)].string), PRE );
							 }
    break;

  case 51:

/* Line 677 of lalr1.cc  */
#line 397 "matrix_grammar.yy"
    {
																					#ifdef DEBUG
																						bisonDebugMessage("CREATING METHOD CALL");
																					#endif
																					(yyval.expr) = new MTMethodCall( *(yysemantic_stack_[(4) - (1)].id), *(yysemantic_stack_[(4) - (3)].expr_vec));
																				}
    break;

  case 52:

/* Line 677 of lalr1.cc  */
#line 403 "matrix_grammar.yy"
    {
					#ifdef DEBUG
						bisonDebugMessage("PASSING ON IDENTIFIER WITHIN EXPRESSION");
					#endif
					(yyval.expr) = (yysemantic_stack_[(1) - (1)].id);
				}
    break;

  case 53:

/* Line 677 of lalr1.cc  */
#line 409 "matrix_grammar.yy"
    {
										#ifdef DEBUG
											bisonDebugMessage("CREATING EXPRESSION IN PARENTHESIS WITHIN EXPRESSION");
										#endif
										(yyval.expr) = new MTParenExpression( *(yysemantic_stack_[(3) - (2)].expr) );
									}
    break;

  case 54:

/* Line 677 of lalr1.cc  */
#line 417 "matrix_grammar.yy"
    { 
						#ifdef DEBUG
							bisonDebugMessage("CREATING ID");
						#endif
						(yyval.id) = new MTIdentifier(*(yysemantic_stack_[(1) - (1)].string)); 
						delete (yysemantic_stack_[(1) - (1)].string); 
					}
    break;

  case 55:

/* Line 677 of lalr1.cc  */
#line 426 "matrix_grammar.yy"
    {
																#ifdef DEBUG
																	bisonDebugMessage("CREATING ID");
																#endif
																(yyval.expr) = new MTMatrix( (yysemantic_stack_[(3) - (2)].matrix_vec) ); 
															}
    break;

  case 56:

/* Line 677 of lalr1.cc  */
#line 434 "matrix_grammar.yy"
    { 
													#ifdef DEBUG
														bisonDebugMessage("PUSHING LIST DEFINITION INTO MATRIX ROWS");
													#endif
													(yysemantic_stack_[(3) - (3)].matrix_vec)->push_back((yysemantic_stack_[(3) - (1)].list)); 
													(yyval.matrix_vec) = (yysemantic_stack_[(3) - (3)].matrix_vec);
												}
    break;

  case 57:

/* Line 677 of lalr1.cc  */
#line 441 "matrix_grammar.yy"
    { 
											#ifdef DEBUG
												bisonDebugMessage("CREATING MATRIX WITH LIST DEFINITIONS");
											#endif
											(yyval.matrix_vec) = new Matrix(); (yyval.matrix_vec)->push_back((yysemantic_stack_[(3) - (3)].list)); (yyval.matrix_vec)->push_back((yysemantic_stack_[(3) - (1)].list)); 
										}
    break;

  case 58:

/* Line 677 of lalr1.cc  */
#line 449 "matrix_grammar.yy"
    {
																#ifdef DEBUG
																	bisonDebugMessage("CREATING NEW LIST");
																#endif 
																(yyval.list) = new MTList((yysemantic_stack_[(3) - (2)].expr_vec));
															}
    break;

  case 59:

/* Line 677 of lalr1.cc  */
#line 457 "matrix_grammar.yy"
    { 
									#ifdef DEBUG
										bisonDebugMessage("CREATING EMPTY 'LIST ELEMENTS' EXPRESSION LIST");
									#endif
									(yyval.expr_vec) = new ExpressionList(); 
								}
    break;

  case 60:

/* Line 677 of lalr1.cc  */
#line 463 "matrix_grammar.yy"
    { 
									#ifdef DEBUG
										bisonDebugMessage("PUSHING EXPRESSION INTO 'LIST ELEMENTS'");
									#endif
									(yysemantic_stack_[(3) - (1)].expr_vec)->push_back((yysemantic_stack_[(3) - (3)].expr)); 
								}
    break;

  case 61:

/* Line 677 of lalr1.cc  */
#line 469 "matrix_grammar.yy"
    {	
					#ifdef DEBUG
						bisonDebugMessage("CREATING EXPRESSION_LIST IN LIST");
					#endif
					(yyval.expr_vec) = new ExpressionList();	(yyval.expr_vec)->push_back((yysemantic_stack_[(1) - (1)].expr));	
				}
    break;

  case 62:

/* Line 677 of lalr1.cc  */
#line 477 "matrix_grammar.yy"
    {   
								#ifdef DEBUG
									bisonDebugMessage("CREATING INTEGER NUMBER: ");
								#endif

								(yyval.expr) = new MTInteger(atol((yysemantic_stack_[(1) - (1)].string)->c_str()));
								delete (yysemantic_stack_[(1) - (1)].string); 
							}
    break;

  case 65:

/* Line 677 of lalr1.cc  */
#line 487 "matrix_grammar.yy"
    { 
					#ifdef DEBUG
						bisonDebugMessage("CREATING FLOAT NUMBER");
					#endif
					(yyval.expr) = new MTFloat(static_cast<float>(atof( (yysemantic_stack_[(1) - (1)].string)->c_str() ) ) );
					delete (yysemantic_stack_[(1) - (1)].string); 
				}
    break;

  case 66:

/* Line 677 of lalr1.cc  */
#line 494 "matrix_grammar.yy"
    {
					#ifdef DEBUG
						bisonDebugMessage("CREATING DOUBLE NUMBER");
					#endif
					(yyval.expr) = new MTDouble(atof((yysemantic_stack_[(1) - (1)].string)->c_str()));
					delete (yysemantic_stack_[(1) - (1)].string); 
				}
    break;

  case 69:

/* Line 677 of lalr1.cc  */
#line 507 "matrix_grammar.yy"
    {
																						#ifdef DEBUG
																							bisonDebugMessage("CREATING MATRIX OPERATION");
																						#endif
																						(yyval.expr) = new MTMatrixBinaryOperator( *(yysemantic_stack_[(3) - (1)].expr), *(yysemantic_stack_[(3) - (2)].string), *(yysemantic_stack_[(3) - (3)].expr) );
																					}
    break;

  case 71:

/* Line 677 of lalr1.cc  */
#line 516 "matrix_grammar.yy"
    {
																						#ifdef DEBUG
																							bisonDebugMessage("CREATING LIST OPERATION");
																						#endif
																						(yyval.expr) = new MTListBinaryOperator( *(yysemantic_stack_[(3) - (1)].list), *(yysemantic_stack_[(3) - (2)].string), *(yysemantic_stack_[(3) - (3)].expr) );
																					}
    break;



/* Line 677 of lalr1.cc  */
#line 1051 "matrix_grammar.tab.cpp"
	default:
          break;
      }
    YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);

    yypop_ (yylen);
    yylen = 0;
    YY_STACK_PRINT ();

    yysemantic_stack_.push (yyval);
    yylocation_stack_.push (yyloc);

    /* Shift the result of the reduction.  */
    yyn = yyr1_[yyn];
    yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
    if (0 <= yystate && yystate <= yylast_
	&& yycheck_[yystate] == yystate_stack_[0])
      yystate = yytable_[yystate];
    else
      yystate = yydefgoto_[yyn - yyntokens_];
    goto yynewstate;

  /*------------------------------------.
  | yyerrlab -- here on detecting error |
  `------------------------------------*/
  yyerrlab:
    /* If not already recovering from an error, report this error.  */
    if (!yyerrstatus_)
      {
	++yynerrs_;
	error (yylloc, yysyntax_error_ (yystate, yytoken));
      }

    yyerror_range[0] = yylloc;
    if (yyerrstatus_ == 3)
      {
	/* If just tried and failed to reuse lookahead token after an
	 error, discard it.  */

	if (yychar <= yyeof_)
	  {
	  /* Return failure if at end of input.  */
	  if (yychar == yyeof_)
	    YYABORT;
	  }
	else
	  {
	    yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
	    yychar = yyempty_;
	  }
      }

    /* Else will try to reuse lookahead token after shifting the error
       token.  */
    goto yyerrlab1;


  /*---------------------------------------------------.
  | yyerrorlab -- error raised explicitly by YYERROR.  |
  `---------------------------------------------------*/
  yyerrorlab:

    /* Pacify compilers like GCC when the user code never invokes
       YYERROR and the label yyerrorlab therefore never appears in user
       code.  */
    if (false)
      goto yyerrorlab;

    yyerror_range[0] = yylocation_stack_[yylen - 1];
    /* Do not reclaim the symbols of the rule which action triggered
       this YYERROR.  */
    yypop_ (yylen);
    yylen = 0;
    yystate = yystate_stack_[0];
    goto yyerrlab1;

  /*-------------------------------------------------------------.
  | yyerrlab1 -- common code for both syntax error and YYERROR.  |
  `-------------------------------------------------------------*/
  yyerrlab1:
    yyerrstatus_ = 3;	/* Each real token shifted decrements this.  */

    for (;;)
      {
	yyn = yypact_[yystate];
	if (yyn != yypact_ninf_)
	{
	  yyn += yyterror_;
	  if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
	    {
	      yyn = yytable_[yyn];
	      if (0 < yyn)
		break;
	    }
	}

	/* Pop the current state because it cannot handle the error token.  */
	if (yystate_stack_.height () == 1)
	YYABORT;

	yyerror_range[0] = yylocation_stack_[0];
	yydestruct_ ("Error: popping",
		     yystos_[yystate],
		     &yysemantic_stack_[0], &yylocation_stack_[0]);
	yypop_ ();
	yystate = yystate_stack_[0];
	YY_STACK_PRINT ();
      }

    yyerror_range[1] = yylloc;
    // Using YYLLOC is tempting, but would change the location of
    // the lookahead.  YYLOC is available though.
    YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
    yysemantic_stack_.push (yylval);
    yylocation_stack_.push (yyloc);

    /* Shift the error token.  */
    YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
		     &yysemantic_stack_[0], &yylocation_stack_[0]);

    yystate = yyn;
    goto yynewstate;

    /* Accept.  */
  yyacceptlab:
    yyresult = 0;
    goto yyreturn;

    /* Abort.  */
  yyabortlab:
    yyresult = 1;
    goto yyreturn;

  yyreturn:
    if (yychar != yyempty_)
      yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);

    /* Do not reclaim the symbols of the rule which action triggered
       this YYABORT or YYACCEPT.  */
    yypop_ (yylen);
    while (yystate_stack_.height () != 1)
      {
	yydestruct_ ("Cleanup: popping",
		   yystos_[yystate_stack_[0]],
		   &yysemantic_stack_[0],
		   &yylocation_stack_[0]);
	yypop_ ();
      }

    return yyresult;
  }

  // Generate an error message.
  std::string
  Parser::yysyntax_error_ (int yystate, int tok)
  {
    std::string res;
    YYUSE (yystate);
#if YYERROR_VERBOSE
    int yyn = yypact_[yystate];
    if (yypact_ninf_ < yyn && yyn <= yylast_)
      {
	/* Start YYX at -YYN if negative to avoid negative indexes in
	   YYCHECK.  */
	int yyxbegin = yyn < 0 ? -yyn : 0;

	/* Stay within bounds of both yycheck and yytname.  */
	int yychecklim = yylast_ - yyn + 1;
	int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
	int count = 0;
	for (int x = yyxbegin; x < yyxend; ++x)
	  if (yycheck_[x + yyn] == x && x != yyterror_)
	    ++count;

	// FIXME: This method of building the message is not compatible
	// with internationalization.  It should work like yacc.c does it.
	// That is, first build a string that looks like this:
	// "syntax error, unexpected %s or %s or %s"
	// Then, invoke YY_ on this string.
	// Finally, use the string as a format to output
	// yytname_[tok], etc.
	// Until this gets fixed, this message appears in English only.
	res = "syntax error, unexpected ";
	res += yytnamerr_ (yytname_[tok]);
	if (count < 5)
	  {
	    count = 0;
	    for (int x = yyxbegin; x < yyxend; ++x)
	      if (yycheck_[x + yyn] == x && x != yyterror_)
		{
		  res += (!count++) ? ", expecting " : " or ";
		  res += yytnamerr_ (yytname_[x]);
		}
	  }
      }
    else
#endif
      res = YY_("syntax error");
    return res;
  }


  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     STATE-NUM.  */
  const signed char Parser::yypact_ninf_ = -42;
  const short int
  Parser::yypact_[] =
  {
        11,   -42,   -42,   -42,   -42,   -42,   -42,    18,    18,   121,
     153,   -28,   -11,    -7,    43,    74,    45,   -42,   -42,   -42,
     -42,    67,   159,   -42,    58,    59,   138,   -42,   -42,   -42,
     -42,   -42,   -42,   153,    67,    83,    39,    46,    33,    21,
     153,   153,    18,   -42,   -42,    11,   153,   153,   153,   153,
     153,   137,   -42,   -42,   153,   -42,   -42,    65,   -42,   -42,
     -42,    73,   153,   -42,    73,   -42,   153,   -42,     5,   -42,
     164,    17,    66,    71,    95,   -42,   159,   159,   -42,   -42,
     -42,    67,   -42,    82,    81,    91,     3,    13,    73,   -42,
     -42,   -42,    46,    67,   153,   153,    11,   -42,   -42,   -42,
     -42,   -42,   -42,   153,    11,   153,    18,   153,    94,   111,
     -42,   153,   115,   115,   102,    67,   107,    42,   -42,    18,
      80,   -42,    11,   -42,   153,   -42,   -42,   -42,   -42,    67,
     114,   117,    23,   -42,    11,   153,   123,   -42,   -42
  };

  /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
     doesn't specify something else to do.  Zero means the default is an
     error.  */
  const unsigned char
  Parser::yydefact_[] =
  {
         2,    54,    62,    63,    64,    65,    66,     0,     0,    59,
       0,     0,     0,     0,     0,     0,     5,     7,     8,    17,
      18,     6,    39,    42,    52,    70,    72,    46,     9,    67,
      68,    50,    49,    59,    61,    52,     0,     0,     0,     0,
       0,     0,     0,     1,     3,     0,     0,     0,     0,     0,
       0,     0,    47,    48,     0,    73,    74,     0,    75,    76,
      77,     0,     0,    55,     0,    58,     0,    53,     0,    29,
       0,     0,     0,    13,     0,     4,    40,    41,    43,    44,
      45,    22,    24,     0,     0,     0,    28,    52,     0,    69,
      71,    56,    57,    60,     0,     0,     0,    33,    34,    35,
      36,    37,    38,     0,     0,     0,     0,     0,    26,     0,
      51,     0,    30,    31,     0,    32,     0,     0,    14,     0,
       0,    27,     0,    11,     0,    25,    23,    20,    19,    21,
       0,     0,    15,    10,     0,     0,     0,    16,    12
  };

  /* YYPGOTO[NTERM-NUM].  */
  const signed char
  Parser::yypgoto_[] =
  {
       -42,   -42,   -41,   -42,    49,    56,    28,   -42,   -42,   -40,
     -42,   -42,    53,    54,   -30,   -42,   -42,    -4,   -37,    62,
       0,   -42,   112,    -8,   -42,   -42,   126,   122,   119,   -42,
     -42
  };

  /* YYDEFGOTO[NTERM-NUM].  */
  const short int
  Parser::yydefgoto_[] =
  {
        -1,    14,    15,    16,    17,    72,   131,    18,   128,    19,
      83,    20,    84,    85,    68,    69,   103,    21,    22,    23,
      35,    25,    36,    26,    38,    27,    28,    29,    30,    57,
      61
  };

  /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
     positive, shift that token.  If negative, reduce the rule which
     number is the opposite.  If zero, do what YYDEFACT says.  */
  const signed char Parser::yytable_ninf_ = -24;
  const short int
  Parser::yytable_[] =
  {
        24,    37,    73,    40,    75,    34,    39,    31,    32,    76,
      77,    71,    46,    47,     1,     2,     3,     4,     5,     6,
      41,     1,    94,    95,    42,     7,     8,    52,    53,    34,
      46,    47,    46,    47,    94,    95,    70,    70,     9,   111,
      10,    96,    74,    43,    62,    24,    11,    81,    12,    13,
      86,    67,   -23,   104,    87,   114,    92,   135,    86,    94,
      95,    65,    93,   116,   112,   113,    73,    63,    55,    66,
      56,    51,    52,    53,    44,   117,    46,    47,   124,    45,
      37,   130,    64,     1,     2,     3,     4,     5,     6,    54,
      70,    70,    88,   136,     7,     8,    24,    52,    53,   115,
      33,    70,   105,    81,    24,   106,    74,    86,   107,    10,
      78,    79,    80,   109,    62,    11,   129,    12,    13,   126,
     132,   108,    24,   110,     1,     2,     3,     4,     5,     6,
     119,   132,    94,    95,    24,     7,     8,   120,   122,   123,
       1,     2,     3,     4,     5,     6,   133,    58,    33,    59,
      10,     7,     8,   134,    60,   138,     1,     2,     3,     4,
       5,     6,   118,   137,     9,   121,    10,     7,     8,   127,
      48,    49,   125,    46,    47,    50,    91,    82,     0,    89,
      90,     0,    10,    97,    98,    99,   100,   101,   102
  };

  /* YYCHECK.  */
  const short int
  Parser::yycheck_[] =
  {
         0,     9,    42,    31,    45,     9,    10,     7,     8,    46,
      47,    41,     9,    10,     3,     4,     5,     6,     7,     8,
      31,     3,    17,    18,    31,    14,    15,    14,    15,    33,
       9,    10,     9,    10,    17,    18,    40,    41,    27,    36,
      29,    36,    42,     0,    31,    45,    35,    51,    37,    38,
      54,    30,    39,    36,    54,    96,    64,    34,    62,    17,
      18,    28,    66,   104,    94,    95,   106,    28,     9,    36,
      11,    13,    14,    15,     0,   105,     9,    10,    36,    34,
      88,   122,    36,     3,     4,     5,     6,     7,     8,    31,
      94,    95,    27,   134,    14,    15,    96,    14,    15,   103,
      27,   105,    36,   107,   104,    34,   106,   111,    13,    29,
      48,    49,    50,    32,    31,    35,   120,    37,    38,   119,
     124,    39,   122,    32,     3,     4,     5,     6,     7,     8,
      36,   135,    17,    18,   134,    14,    15,    26,    36,    32,
       3,     4,     5,     6,     7,     8,    32,     9,    27,    11,
      29,    14,    15,    36,    16,    32,     3,     4,     5,     6,
       7,     8,   106,   135,    27,   111,    29,    14,    15,   120,
      11,    12,   119,     9,    10,    16,    64,    51,    -1,    57,
      61,    -1,    29,    19,    20,    21,    22,    23,    24
  };

  /* STOS_[STATE-NUM] -- The (internal number of the) accessing
     symbol of state STATE-NUM.  */
  const unsigned char
  Parser::yystos_[] =
  {
         0,     3,     4,     5,     6,     7,     8,    14,    15,    27,
      29,    35,    37,    38,    41,    42,    43,    44,    47,    49,
      51,    57,    58,    59,    60,    61,    63,    65,    66,    67,
      68,    60,    60,    27,    57,    60,    62,    63,    64,    57,
      31,    31,    31,     0,     0,    34,     9,    10,    11,    12,
      16,    13,    14,    15,    31,     9,    11,    69,     9,    11,
      16,    70,    31,    28,    36,    28,    36,    30,    54,    55,
      57,    54,    45,    49,    60,    42,    58,    58,    59,    59,
      59,    57,    66,    50,    52,    53,    57,    60,    27,    67,
      68,    62,    63,    57,    17,    18,    36,    19,    20,    21,
      22,    23,    24,    56,    36,    36,    34,    13,    39,    32,
      32,    36,    54,    54,    42,    57,    42,    54,    45,    36,
      26,    53,    36,    32,    36,    52,    60,    44,    48,    57,
      42,    46,    57,    32,    36,    34,    42,    46,    32
  };

#if YYDEBUG
  /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
     to YYLEX-NUM.  */
  const unsigned short int
  Parser::yytoken_number_[] =
  {
         0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     285,   286,   287,   288,    59,    73,    44,    87,    70,    95
  };
#endif

  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
  const unsigned char
  Parser::yyr1_[] =
  {
         0,    40,    41,    41,    42,    42,    43,    43,    43,    43,
      44,    44,    44,    45,    45,    46,    46,    47,    47,    47,
      48,    48,    49,    50,    51,    52,    52,    53,    53,    54,
      54,    54,    55,    56,    56,    56,    56,    56,    56,    57,
      57,    57,    58,    58,    58,    58,    59,    59,    59,    59,
      59,    59,    59,    59,    60,    61,    62,    62,    63,    64,
      64,    64,    65,    65,    65,    65,    65,    66,    66,    67,
      67,    68,    68,    69,    69,    70,    70,    70
  };

  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
  const unsigned char
  Parser::yyr2_[] =
  {
         0,     2,     0,     2,     3,     1,     1,     1,     1,     1,
       8,     6,    10,     1,     3,     1,     3,     1,     1,     6,
       1,     1,     3,     1,     3,     4,     2,     3,     1,     1,
       3,     3,     3,     1,     1,     1,     1,     1,     1,     1,
       3,     3,     1,     3,     3,     3,     1,     2,     2,     2,
       2,     4,     1,     3,     1,     3,     3,     3,     3,     0,
       3,     1,     1,     1,     1,     1,     1,     1,     1,     3,
       1,     3,     1,     1,     1,     1,     1,     1
  };

#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
     First, the terminals, then, starting at \a yyntokens_, nonterminals.  */
  const char*
  const Parser::yytname_[] =
  {
    "\"end of file\"", "error", "$undefined", "ID", "DECINTEGER",
  "HEXINTEGER", "OCTINTEGER", "FLOATNUMBER", "DOUBLENUMBER", "ADD", "SUB",
  "MUL", "DIV", "EQ", "DEC", "INC", "DOT", "AND", "OR", "ISEQUAL",
  "ISNOTEQUAL", "GT", "GE", "LT", "LE", "KEYWORD", "ASSIGN", "BRACEOPEN",
  "BRACECLOSE", "PARENOPEN", "PARENCLOSE", "BRACKETOPEN", "BRACKETCLOSE",
  "\"end of line\"", "';'", "'I'", "','", "'W'", "'F'", "'_'", "$accept",
  "start", "statements", "statement", "control_statement", "for_init_list",
  "increment_statements", "definition", "function_statement",
  "variable_definition", "variable_declaration",
  "container_variable_definition", "function_argument_list",
  "function_actual_argument_list", "conditions", "condition", "comparison",
  "expression", "term", "primary", "identifier", "matrix_definition",
  "matrix_rows", "list_definition", "list_elements", "variable",
  "container_type_expression", "matrix_expression", "list_expression",
  "matrix_operation", "list_operation", 0
  };
#endif

#if YYDEBUG
  /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
  const Parser::rhs_number_type
  Parser::yyrhs_[] =
  {
        41,     0,    -1,    -1,    42,     0,    -1,    43,    34,    42,
      -1,    43,    -1,    57,    -1,    44,    -1,    47,    -1,    66,
      -1,    35,    31,    54,    36,    42,    36,    42,    32,    -1,
      37,    31,    54,    36,    42,    32,    -1,    38,    31,    45,
      36,    54,    36,    46,    36,    42,    32,    -1,    49,    -1,
      49,    34,    45,    -1,    57,    -1,    57,    34,    46,    -1,
      49,    -1,    51,    -1,    60,    31,    52,    32,    26,    48,
      -1,    44,    -1,    57,    -1,    60,    13,    57,    -1,    60,
      -1,    60,    13,    66,    -1,    50,    39,    36,    52,    -1,
      50,    39,    -1,    57,    36,    53,    -1,    57,    -1,    55,
      -1,    54,    17,    54,    -1,    54,    18,    54,    -1,    57,
      56,    57,    -1,    19,    -1,    20,    -1,    21,    -1,    22,
      -1,    23,    -1,    24,    -1,    58,    -1,    57,     9,    58,
      -1,    57,    10,    58,    -1,    59,    -1,    58,    11,    59,
      -1,    58,    12,    59,    -1,    58,    16,    59,    -1,    65,
      -1,    60,    14,    -1,    60,    15,    -1,    15,    60,    -1,
      14,    60,    -1,    60,    31,    53,    32,    -1,    60,    -1,
      29,    57,    30,    -1,     3,    -1,    27,    62,    28,    -1,
      63,    36,    62,    -1,    63,    36,    63,    -1,    27,    64,
      28,    -1,    -1,    64,    36,    57,    -1,    57,    -1,     4,
      -1,     5,    -1,     6,    -1,     7,    -1,     8,    -1,    67,
      -1,    68,    -1,    61,    69,    67,    -1,    61,    -1,    63,
      70,    68,    -1,    63,    -1,     9,    -1,    11,    -1,     9,
      -1,    11,    -1,    16,    -1
  };

  /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
     YYRHS.  */
  const unsigned char
  Parser::yyprhs_[] =
  {
         0,     0,     3,     4,     7,    11,    13,    15,    17,    19,
      21,    30,    37,    48,    50,    54,    56,    60,    62,    64,
      71,    73,    75,    79,    81,    85,    90,    93,    97,    99,
     101,   105,   109,   113,   115,   117,   119,   121,   123,   125,
     127,   131,   135,   137,   141,   145,   149,   151,   154,   157,
     160,   163,   168,   170,   174,   176,   180,   184,   188,   192,
     193,   197,   199,   201,   203,   205,   207,   209,   211,   213,
     217,   219,   223,   225,   227,   229,   231,   233
  };

  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
  const unsigned short int
  Parser::yyrline_[] =
  {
         0,   147,   147,   148,   156,   164,   172,   178,   179,   180,
     183,   189,   195,   203,   209,   218,   224,   232,   233,   234,
     242,   243,   251,   259,   266,   274,   282,   291,   298,   306,
     307,   313,   321,   329,   329,   329,   329,   329,   329,   332,
     333,   339,   347,   348,   354,   360,   368,   373,   379,   385,
     391,   397,   403,   409,   417,   426,   434,   441,   449,   457,
     463,   469,   477,   485,   486,   487,   494,   503,   504,   507,
     513,   516,   522,   525,   526,   529,   530,   531
  };

  // Print the state stack on the debug stream.
  void
  Parser::yystack_print_ ()
  {
    *yycdebug_ << "Stack now";
    for (state_stack_type::const_iterator i = yystate_stack_.begin ();
	 i != yystate_stack_.end (); ++i)
      *yycdebug_ << ' ' << *i;
    *yycdebug_ << std::endl;
  }

  // Report on the debug stream that the rule \a yyrule is going to be reduced.
  void
  Parser::yy_reduce_print_ (int yyrule)
  {
    unsigned int yylno = yyrline_[yyrule];
    int yynrhs = yyr2_[yyrule];
    /* Print the symbols being reduced, and their result.  */
    *yycdebug_ << "Reducing stack by rule " << yyrule - 1
	       << " (line " << yylno << "):" << std::endl;
    /* The symbols being reduced.  */
    for (int yyi = 0; yyi < yynrhs; yyi++)
      YY_SYMBOL_PRINT ("   $" << yyi + 1 << " =",
		       yyrhs_[yyprhs_[yyrule] + yyi],
		       &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
		       &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
  }
#endif // YYDEBUG

  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
  Parser::token_number_type
  Parser::yytranslate_ (int t)
  {
    static
    const token_number_type
    translate_table[] =
    {
           0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,    36,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,    34,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      38,     2,     2,    35,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,    37,     2,     2,
       2,     2,     2,     2,     2,    39,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31,    32,    33
    };
    if ((unsigned int) t <= yyuser_token_number_max_)
      return translate_table[t];
    else
      return yyundef_token_;
  }

  const int Parser::yyeof_ = 0;
  const int Parser::yylast_ = 188;
  const int Parser::yynnts_ = 31;
  const int Parser::yyempty_ = -2;
  const int Parser::yyfinal_ = 43;
  const int Parser::yyterror_ = 1;
  const int Parser::yyerrcode_ = 256;
  const int Parser::yyntokens_ = 40;

  const unsigned int Parser::yyuser_token_number_max_ = 288;
  const Parser::token_number_type Parser::yyundef_token_ = 2;


} // MathematicaTranslator

/* Line 1053 of lalr1.cc  */
#line 1606 "matrix_grammar.tab.cpp"


/* Line 1055 of lalr1.cc  */
#line 534 "matrix_grammar.yy"
  /* additional code */


void MathematicaTranslator::Parser::error(const MathematicaTranslator::Parser::location_type &l, const std::string &m)
{
	driver.error(l,m);
}

